package com.car.datalayer.http;

import java.io.Serializable;

public class RequestId implements Serializable{
	private static final long serialVersionUID = 1L;
	
	private int id = 0;
	private int level = 0;
	private static int lastId = 10;
	
	private RequestId(int id, int level){
		this.id = id;
		this.level = level;
	}
	
	@Override
	public boolean equals(Object o){
		if(o == null ||
		   this.getClass() != o.getClass()){
			return false;
		}
		if(this == o){
			return true;
		}
		RequestId oInstance = (RequestId)o;
		return this.id == oInstance.id;
	}
	
	@Override
	public int hashCode(){
		return this.id;
	}
	
	public static RequestId CreateId(int level){
		return new RequestId(lastId++, level);
	}
	
	public final int getLevel() {
		return level;
	}
	
	@Override
	public String toString(){
		return Integer.toString(this.id);
	}

	
}
